---
title: Sensors
description: A library that provides access to a device's accelerometer, barometer, motion, gyroscope, magnetometer, and pedometer.
sourceCodeUrl: 'https://github.com/expo/expo/tree/sdk-49/packages/expo-sensors'
packageName: 'expo-sensors'
iconUrl: '/static/images/packages/expo-sensors.png'
---

import { Speedometer04Icon } from '@expo/styleguide-icons/outline/Speedometer04Icon';

import { APIInstallSection } from '~/components/plugins/InstallSection';
import PlatformsSection from '~/components/plugins/PlatformsSection';
import { AndroidPermissions } from '~/components/plugins/permissions';
import { BoxLink } from '~/ui/components/BoxLink';
import { ConfigReactNative } from '~/ui/components/ConfigSection';

`expo-sensors` provide various APIs for accessing device sensors to measure motion, orientation, pressure, magnetic fields, ambient light, and step count.

<PlatformsSection android emulator ios simulator web />

## Installation

<APIInstallSection />

## API

```js
import * as Sensors from 'expo-sensors';
// OR
import {
  Accelerometer,
  Barometer,
  DeviceMotion,
  Gyroscope,
  LightSensor,
  Magnetometer,
  MagnetometerUncalibrated,
  Pedometer,
} from 'expo-sensors';
```

## Permissions

### Android

Starting in Android 12 (API level 31), the system has a 200Hz limit for each sensor updates.

If you need an update interval of less than 200Hz, you must add the following permissions to your **app.json** inside the [`expo.android.permissions`](/versions/latest/config/app/#permissions) array.

<AndroidPermissions permissions={['HIGH_SAMPLING_RATE_SENSORS']} />

<ConfigReactNative>

Learn how to configure the native projects in the [installation instructions in the `expo-sensors` repository](https://github.com/expo/expo/tree/main/packages/expo-sensors#installation-in-bare-react-native-projects).

</ConfigReactNative>

## Available sensors

For more information, please see the documentation for the sensor you are interested in:

<BoxLink
  title="Accelerometer"
  href="accelerometer"
  description="Measures device acceleration on all platforms."
  Icon={Speedometer04Icon}
/>
<BoxLink
  title="Barometer"
  href="barometer"
  description="Measures pressure on Android and iOS platforms."
  Icon={Speedometer04Icon}
/>
<BoxLink
  title="DeviceMotion"
  href="devicemotion"
  description="Measures device motion on all platforms."
  Icon={Speedometer04Icon}
/>
<BoxLink
  title="Gyroscope"
  href="gyroscope"
  description="Measures device rotation on all platforms."
  Icon={Speedometer04Icon}
/>
<BoxLink
  title="Magnetometer"
  href="magnetometer"
  description="Measures magnetic fields on Android and iOS platforms."
  Icon={Speedometer04Icon}
/>
<BoxLink
  title="LightSensor"
  href="light-sensor"
  description="Measures ambient light on Android platform."
  Icon={Speedometer04Icon}
/>
<BoxLink
  title="Pedometer"
  href="pedometer"
  description="Measures steps count on Android and iOS platforms."
  Icon={Speedometer04Icon}
/>
